#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from app.core.database import SessionLocal
from app.models.base_model import User, Role

def check_database():
    """检查数据库内容"""
    db = SessionLocal()
    try:
        print("\n=== 用户数据 ===")
        users = db.query(User).all()
        for user in users:
            print(f"ID: {user.id}")
            print(f"用户名: {user.username}")
            print(f"角色ID: {user.role_id}")
            print(f"状态: {user.status}")
            print(f"创建时间: {user.create_time}")
            print(f"更新时间: {user.update_time}")
            print("-" * 30)

        print("\n=== 角色数据 ===")
        roles = db.query(Role).all()
        for role in roles:
            print(f"ID: {role.id}")
            print(f"名称: {role.name}")
            print(f"权限: {role.permissions}")
            print(f"状态: {role.status}")
            print(f"创建时间: {role.create_time}")
<<<<<<< HEAD
            print(f"更新时间: {role.update_time}")
=======
            print(f"更新��间: {role.update_time}")
>>>>>>> 3c947f1aba3ee54d50472e0f837782629d528bae
            print("-" * 30)

    except Exception as e:
        print(f"错误: {e}")
    finally:
        db.close()

if __name__ == "__main__":
    check_database() 